Skip to content

Commit

Permalink
Byte alignment is made explicit
Browse files Browse the repository at this point in the history
With Golomb Rice coding mode, bits are consumed one per one
but the last bits in the bitstream (slice_size, error_status,
slice_crc_parity) are byte aligned, so there is some padding
in the bitstream before slice_size.
  • Loading branch information
JeromeMartinez authored and michaelni committed May 25, 2016
1 parent 2a4c5ba commit 9c92e4b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ffv1.md
Expand Up @@ -153,6 +153,8 @@ __a...b__ means any value starting from a to b, inclusive.

**remaining\_bits\_in\_bitstream( )** means the count of remaining bits after the current position in the bitstream. It is computed from the NumBytes value multiplied by 8 minus the count of bits already read by the bitstream parser.

**byte\_aligned( )** means remaining\_bits\_in\_bitstream( ) % 8 is 0.

\pagebreak

# General Description
Expand Down Expand Up @@ -541,6 +543,9 @@ See [NUT](#references) for more information about elements.
|            for( p = 0; p \< primary\_color\_count; p++ ) { | |
|                Line( p, y ) | |
|    } | |
|    if ( coder\_type == 0 ) | |
| while ( !byte\_aligned() ) | |
|         padding | u(1) |
|    if( i \|\| version \> 2 ) | |
|        slice\_size | u(24) |
|    if( ec ) { | |
Expand All @@ -551,6 +556,9 @@ See [NUT](#references) for more information about elements.

**primary\_color\_count** is defined as 1 + ( chroma_planes ? 2 : 0 ) + ( alpha_plane ? 1 : 0 ).

**padding** specifies a bit without any significance and used only for byte alignment.
MUST be 0.

**slice_size** indicates the size of the slice in bytes.
Note: this allows finding the start of slices before previous slices have been fully decoded. And allows this way parallel decoding as well as error resilience.

Expand Down

0 comments on commit 9c92e4b

Please sign in to comment.